<#import "/common/function.ftl" as fn>
    <@fn.header _title="核对家庭成员基本信息">
        <script language="javascript" type="text/javascript" src="${base}/web/js/My97DatePicker/WdatePicker.js"></script>
        <script language="javascript" type="text/javascript">
            function openNewDiv(id) {
                //mask遮罩层
                var newMask = document.createElement("div");
                newMask.id = "mask";
                newMask.style.position = "absolute";
                newMask.style.zIndex = "1";
                newMask.style.width = document.body.clientWidth + "px";
                newMask.style.height = document.body.clientHeight + "px";
                newMask.style.top = "0px";
                newMask.style.left = "0px";
                newMask.style.background = "#33393C";
                newMask.style.filter = "alpha(opacity=40)";
                newMask.style.opacity = "0.50";
                document.body.appendChild(newMask);
                //新弹出层
                var newDiv = document.getElementById(id);
                newDiv.style.display = "block";
                newDiv.style.position = "absolute";
                newDiv.style.zIndex = "9999";
                newDiv.style.background = "#EFEFEF";
                document.documentElement.style.overflow = 'hidden'; //去除页面滚动条
                autoMargin(id)
            }
            function CloseMast(id) {
                try {
                    document.body.removeChild(document.getElementById("mask"));
                    document.getElementById(id).style.display = "none";
                } catch(e) {}
            }

            function autoMargin(id) {
                var mainEle = document.getElementById(id);
                mainEle.style.left = (document.body.clientWidth - mainEle.style.width.substr(0, 3)) / 2 + "px";
                mainEle.style.top = (document.body.clientHeight - mainEle.style.height.substr(0, 3)) / 2 + "px";
            }

            function selectFile() {
                var fileName = File1.value;
                var size = File1.size;
                var state = "待传";
                // btnDeleteRow();
                var rownum = $("#uploadfile tr").length - 1;
                var row = "<tr><td>" + fileName + "</td><td>" + size + "</td><td>" + state + "</td></tr>";
                $(row).insertAfter($("#uploadfile tr:eq(" + rownum + ")"));
            }

            function btnDeleteRow() {
                $("#uploadfile tr").each(function(i) {
                    if (i != 0) {
                        $(this).remove();
                    }
                });
            }
        </script>
        <script language="javascript" type="text/javascript">
            function showTable() {
                $("#table2").toggle(200);
            }
            function showPerson(personId) {
                <#list familyMembers as data>
                if(personId=='${data.id}'){
                    $("#idType").val("${data.idType}");
                    $("#idNumber").val(${data.idNumber});
                    $("#name").val("${data.name}");
                    $("#familyMemberId").val("${data.id}");
                    <#if data.birthday!=null>
                    $("#birthday").val("${(data.birthday)?string('yyyy-MM-dd')}");
                    </#if>
                }
                </#list>
            }
            
            function saveFamilyMemberInfo() {
			    var url = "/infoInput/updateFamilyMemberInfo/";
			    $.ajax({
			           type: "POST",
			           url: url,
			           data: $("#familyMemberForm").serialize(),
			           error: function()
			           {
			               alert("出错啦！");
			           },
			           success: function(data)
			           {
			               alert("保存成功！");
			               $(".visited").find("a")[0].click();
			           }
			         });
			}
			
			function deleteFamilyMemberInfo(id){
				var url = "/infoInput/deleteFamilyMemberInfo/"+id;
			    $.ajax({
			           type: "POST",
			           url: url,
			           data: $("#familyMemberForm").serialize(),
			           error: function()
			           {
			               alert("出错啦！");
			           },
			           success: function(data)
			           {
			               alert("删除成功！");
			               $(".visited").find("a")[0].click();
			           }
			  });
			}
        </script>
    </@fn.header>
    
    <body>
        <div class="rightBk">
            <@fn.position _value="信息录入 &gt;&gt; 核对家庭成员基本信息" />
            <!-- 选项卡 -->
            <div style="margin:0px 0;height:30px">
                <ul class="tab">
                    <li>
                        <a href="/infoInput/familyBasicInfo/${checkTotalId}">
                            核对家庭基本信息
                        </a>
                    </li>
                    <li class="visited">
                        <a href="/infoInput/familyMemberInfo/${checkTotalId}">
                            核对家庭成员基本信息
                        </a>
                    </li>
                    <li>
                        <a href="/infoInput/familyMemberIncome/${checkTotalId}">
                            家庭成员可支配收入
                        </a>
                    </li>
                    <li>
                        <a href="memberProperty.html">
                            家庭成员财产
                        </a>
                    </li>
                    <li>
                        <a href="sendCheck.html">
                            发送街镇核实
                        </a>
                    </li>
                </ul>
            </div>
            <div class="title">
                <div class="title-middle">
                    <div class="title-left">
                    </div>
                    <div class="title-caption">
                        核对家庭成员信息概要
                    </div>
                    <div class="title-right">
                    </div>
                </div>
            </div>
            <!-- table -->
            <table class="tableCenter">
                <tr>
                    <th width="8%">
                        序号
                    </th>
                    <th width="15%">
                        姓名
                    </th>
                    <th width="17%">
                        与申请人代表关系
                    </th>
                    <th width="25%">
                        证件号
                    </th>
                    <th width="20%">
                        申请人类型
                    </th>
                    <th width="20%">
                        操作
                    </th>
                </tr>
                <#list familyMembers as fm>
                    <tr>
                        <td>
                            ${fm_index+1}
                        </td>
                        <td>
                            <a href="#" onclick="showPerson('${fm.id}');">
                                ${fm.name}
                            </a>
                        </td>
                        <td>
                            ${fm.relationMainApplicant}
                        </td>
                        <td>
                            ${fm.idNumber}
                        </td>
                        <td>
                            共同申请人
                        </td>
                        <td>
                            <#if (fm.mainApplicant==true)>
                                <a href="">
                                    添加
                                </a>
                                <#else>
                                <a href="#" onclick="deleteFamilyMemberInfo('${fm.id}')">
                                    删除
                                </a>
                            </#if>
                        </td>
                    </tr>
                </#list>
            </table>
            <br />
            <!-- title -->
            <div class="title">
                <div class="title-middle">
                    <div class="title-left">
                    </div>
                    <div class="title-caption">
                        家庭成员基本信息
                    </div>
                    <div class="title-right">
                    </div>
                </div>
            </div>
            <!-- table -->
            <form action="/infoInput/updateFamilyMemberInfo/" method="POST" name="familyMemberForm" id="familyMemberForm">
            <table class="table1">
                <colgroup>
                    <col style="width: 12%; background-color: #eef3f7;" />
                    <col style="width: 17%;" />
                    <col style="width: 8%; background-color: #eef3f7;" />
                    <col style="width: 8%;" />
                    <col style="width: 6%; background-color: #eef3f7;" />
                </colgroup>
                <tr>
                    <td>
                        证件类型
                    </td>
                    <td>
                        <select class="select1" name="idType" id="idType">
                            <option value="01">
                                身份证
                            </option>
                            <option value="02">
                                护照
                            </option>
                            <option value="03">
                                居住证
                            </option>
                            <option value="04">
                                军官证
                            </option>
                            <option value="05">
                                出生证
                            </option>
                            <option value="06">
                                绿卡
                            </option>
                            <option value="07">
                                港澳通行证
                            </option>
                            <option value="08">
                                其他证件
                            </option>
                            <option selected="selected" value="">
                                请选择
                            </option>
                        </select>
                    </td>
                    <td colspan="3">
                        证件号码
                    </td>
                    <td>
                        <input type="text" class="input4" id="idNumber" name="idNumber" />
                    </td>
                </tr>
                <tr>
                    <td>
                        姓名
                    </td>
                    <td>
                        <input type="text" id="name" name="name" class="input4" />
                    </td>
                    <td>
                        性别
                    </td>
                    <td>
                        <select class="input6" name="gender">
                            <option value="1">
                                男
                            </option>
                            <option value="0">
                                女
                            </option>
                        </select>
                    </td>
                    <td>
                        文化程度
                    </td>
                    <td>
                        <select class="select1" name="education">
                            <option value="01">
                                大学
                            </option>
                            <option value="02">
                                大专
                            </option>
                            <option value="03">
                                高中
                            </option>
                            <option value="06">
                                研究生
                            </option>
                            <option value="07">
                                博士
                            </option>
                            <option selected="selected" value="">
                                请选择
                            </option>
                        </select>
                    </td>
                </tr>
                <tr>
                	<td>
                        婚姻状况
                    </td>
                    <td>
                        <select class="select1" name="maritalStatus">
                            <option value="01">
                                已婚
                            </option>
                            <option value="02">
                                未婚
                            </option>
                            <option value="03">
                                离婚
                            </option>
                            <option value="04">
                                丧偶
                            </option>
                            <option selected="selected" value="">
                                请选择
                            </option>
                        </select>
                    </td>
                    <td colspan="3">
                        出生日期
                    </td>
                    <td>
                        <input type="text" class="input4" onclick="WdatePicker()" name="birthday" id="birthday"/>
                    </td>
                </tr>
                <!--
                <tr>
                    <td>
                        民族
                    </td>
                    <td>
                        国籍
                    </td>
                    <td>
                        政治面貌
                    </td>
                    <td>
                        婚姻状况
                    </td>
                    <td>
                        结婚登记日期
                    </td>
                    <td>
                        户籍类型
                    </td>
                    <td>
                        户籍所在地地址
                    </td>
                    <td>
                        户籍所在地行政区划代码
                    </td>
                    <td>
                        现居住地地址
                    </td>
                    <td>
                        现居住地行政区划代码
                    </td>
                    <td>
                        现居住地开始居住时间
                    </td>
                    <td>
                        健康状况
                    </td>
                    <td>
                        劳动能力丧失状况
                    </td>
                    <td>
                        残疾等级
                    </td>
                    <td>
                        所患主要疾病名称
                    </td>
                    <td>
                        是否主申请人
                    </td>
                    <td>
                        与主申请人关系
                    </td>
                    <td>
                        固定电话
                    </td>
                    <td>
                        手机号码
                    </td>
                    <td>
                    邮政编码
                    </td>
                    
                    <td>
                    通讯地址
                    </td>
                    
                    <td>
                    家庭成员收入
                    </td>
                </tr>
                -->
                <tr>
                    <td>
                        入市户籍年月
                    </td>
                    <td>
                        <input type="text" class="input4" />
                    </td>
                    <td colspan="3">
                        入申请区户籍年月
                    </td>
                    <td>
                        <input type="text" class="input4" />
                    </td>
                </tr>
                <tr>
                    <td>
                        入现户籍地年月
                    </td>
                    <td>
                        <input type="text" class="input4" />
                    </td>
                    <td colspan="3">
                        当前工作单位(全称)
                    </td>
                    <td>
                        <input type="text" class="input4" />
                    </td>
                </tr>
            </table>
            <input type="hidden" id="familyMemberId" name="familyMemberId" value=""/>
            <input type="hidden" name="checkTotalId" value="${checkTotalId}"/>
            </form>
            <br />
            <!-- title -->
            <div class="title marginTop15">
                <div class="title-middle">
                    <div class="title-left">
                    </div>
                    <div class="title-caption">
                        证明材料
                    </div>
                    <div class="title-right">
                    </div>
                </div>
                <!-- table -->
                <table class="tableCenter">
                    <tr>
                        <th width="8%">
                            选择
                        </th>
                        <th width="8%">
                            序号
                        </th>
                        <th width="52%">
                            材料名称
                        </th>
                        <th width="8%">
                            份数
                        </th>
                        <th width="8%">
                            页数
                        </th>
                        <th width="8%">
                            属性
                        </th>
                        <th width="8%">
                            归还
                        </th>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                </table>
                <div>
                    <img src="${base}/web/img/btnAddCl.gif" alt="" onclick='openNewDiv("divDetail");'/>
                </div>
                <!-- button -->
                <div class="marginTop15 alignCenter">
                    <img src="${base}/web/img/btnSave.gif" alt="" onclick="saveFamilyMemberInfo();"/>
                    <img src="${base}/web/img/btnCancel.gif" alt="" />
                    <img src="${base}/web/img/btnLast.gif" alt="" />
                    <img src="${base}/web/img/btnNext.gif" alt="" />
                </div>
                <!-- title -->
            </div>
            <div id="tools">
                <div class="materialsDiv" id="divDetail" style="display:none; width: 650px; height: 200px;">
                    <div class="materialsTitle">
                        <div class="materialsTitleL">
                            添加材料
                        </div>
                        <div class="materialsTitleR">
                            <a href="#">
                                <img src="${base}/web/img/close.gif" border="0" onclick='CloseMast("divDetail");'
                                />
                            </a>
                        </div>
                    </div>
                    <div style="height: 135px;">
                        <table class="materialsGrid" id="uploadfile">
                            <tr style="height: 20px;">
                                <th style="width: 60%; height: 20px;">
                                    文件名
                                </th>
                                <th>
                                    大小
                                </th>
                                <th>
                                    状态
                                </th>
                            </tr>
                        </table>
                    </div>
                    <div class="materialsBtn">
                        <a href="#">
                            <img src="${base}/web/img/btnAddCl.gif" alt="" width="80" height="25"
                            border="0" onclick="File1.click();selectFile();" />
                        </a>
                        <img src="${base}/web/img/btnUpload.gif" width="80" height="25" alt=""
                        />
                        <input id="File1" type="file" style="display: none;" />
                    </div>
                </div>
            </div>
    </body>
    </html>